/*
 * @Description:
 * @Author: 崔堂袁
 * @Date: 2021-05-01 15:13:18
 * @LastEditTime: 2021-05-04 21:55:10
 */
const state = {
  modelIndex: null, // 模型类型
  name: null,
  position: {
    x: 0,
    y: 0,
    z: 0
  },
  rotate: {
    x: 0,
    y: 0,
    z: 0
  },
  // 圆形
  radius: null,
  segments: null,
  colorValue: null,
  // plane平面
  width: null,
  height: null,
  color: null,
  // ring圆环
  innerRadius: null,
  outerRadius: null,
  ringSegments: null,
  // box长方体
  depth: null,
  // sphere球体
  sphereWidthSegment: null,
  sphereHeightSegment: null,
  // cylinder圆柱体
  radiusTop: null,
  radiusBottom: null,
  radialSegments: null,
  heightSegments: null,
  openEnded: false,
  // 甜甜圈
  circleRadius: null,
  tube: null,
  circleRadialSegments: null,
  tubularSegments: null,
  // 环状扭结
  p: null,
  q: null
}

const getters = {}

const actions = {}

const mutations = {
  saveData (state, dataObj) {
    if (dataObj.name) state.name = dataObj.name
    if (dataObj.colorValue) state.colorValue = dataObj.colorValue
    if (dataObj.position) state.position = dataObj.position
    if (dataObj.rotate) state.rotate = dataObj.rotate
    if (dataObj.radius) state.radius = dataObj.radius
    if (dataObj.segments) state.segments = dataObj.segments
    if (dataObj.width) state.width = dataObj.width
    if (dataObj.height) state.height = dataObj.height
    if (dataObj.color) state.color = dataObj.color
    if (dataObj.innerRadius) state.innerRadius = dataObj.innerRadius
    if (dataObj.outerRadius) state.outerRadius = dataObj.outerRadius
    if (dataObj.ringSegments) state.ringSegments = dataObj.ringSegments
    if (dataObj.depth) state.depth = dataObj.depth
    if (dataObj.sphereWidthSegment) state.sphereWidthSegment = dataObj.sphereWidthSegment
    if (dataObj.sphereHeightSegment) state.sphereHeightSegment = dataObj.sphereHeightSegment
    if (dataObj.radiusTop) state.radiusTop = dataObj.radiusTop
    if (dataObj.radiusBottom) state.radiusBottom = dataObj.radiusBottom
    if (dataObj.radialSegments) state.radialSegments = dataObj.radialSegments
    if (dataObj.heightSegments) state.heightSegments = dataObj.heightSegments
    if (dataObj.openEnded) state.openEnded = dataObj.openEnded
    if (dataObj.circleRadius) state.circleRadius = dataObj.circleRadius
    if (dataObj.tube) state.tube = dataObj.tube
    if (dataObj.circleRadialSegments) state.circleRadialSegments = dataObj.circleRadialSegments
    if (dataObj.tubularSegments) state.tubularSegments = dataObj.tubularSegments
    if (dataObj.p) state.p = dataObj.p
    if (dataObj.q) state.q = dataObj.q
  },
  updatePosition (state, dataObj) {
    state.position = dataObj
  },
  updateModelIndex (state, newIndex) {
    state.modelIndex = newIndex
  }
}
export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
}
